package jxc.data.hibernate.dao;

import org.hibernate.Query;

import jxc.data.hibernate.pojo.Outport;

public class OutportDAO extends HibernateBaseDAO<Outport> {
	
	public Outport getById(String id){
		String hql="from Outport where id=:id";
		Query query=session.createQuery(hql);
		query.setString("id", id);
		return (Outport) query.uniqueResult();
	}
	
	public long countGoods(String gid){
		String hql="select sum(number) from Outport where tbGoods.id=:id";
		Query query=session.createQuery(hql);
		query.setString("id", gid);
		Long number=(Long)query.uniqueResult();
		if(number==null)
			return 0;
		return number;
	}
}
